package com.esfak47.mediafetcher.plugin.pornhub;

import com.esfak47.mediafetcher.plugin.pornhub.dto.PornHubSearchResult;
import retrofit2.http.GET;
import retrofit2.http.Query;

import java.util.concurrent.CompletableFuture;

//https://api.pornhub.com/api_android_v3/getVideos?appKey=72d2512a43364263e9d94f0f73&uuid=e919795c0216f29b&order=mv
// &filter=&limit=2&offset=0&search=jap
public interface PornHubAPI {

    String APP_KEY = "72d2512a43364263e9d94f0f73";
    String UUID = "e919795c0216f29b";

    /**
     * @param appKey
     * @param uuid
     * @param order
     * @param filter
     * @param limit
     * @param offset
     * @param searchKey
     * @return
     */
    @GET("api_android_v3/getVideos")
    CompletableFuture<PornHubSearchResult> search(@Query(value = "appKey") String appKey,
                                                  @Query(value = "uuid") String uuid,
                                                  @Query(value = "order") String order,
                                                  @Query(value = "filter") String filter,
                                                  @Query(value = "limit") int limit,
                                                  @Query(value = "offset") int offset,
                                                  @Query(value = "search") String searchKey);

    /**
     * @param order
     * @param limit
     * @param offset
     * @param searchKey
     * @return
     */
    default CompletableFuture<PornHubSearchResult> search(OrderType order,
                                                          int limit,
                                                          int offset,
                                                          String searchKey) {
        return this.search(APP_KEY, UUID, order.toString(), "", limit, offset, searchKey);
    }

    enum OrderType {
        mr("Most Rele"),
        mv("Most view");
        String desc;

        OrderType(String desc) {this.desc = desc;}
    }

}
